/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jse;

/**
 *
 * @author WangShuai
 */
public class ClassPathTest {
    public static void main(String[] args) {
        System.out.println("User.dir : " + System.getProperty("user.dir")); 
        //User.dir : D:\Cloud\Projects\Test
        //系统属性获得工程目录
        
        System.out.println(ClassPathTest.class.getResource("/")); 
        //file:/D:/Cloud/Projects/Test/build/classes/
        ////ClassPathTest.class文件的不包括包的绝对路径，且不包括自身
        
        System.out.println(ClassPathTest.class.getResource(""));  
        //file:/D:/Cloud/Projects/Test/build/classes/jse/   
        //ClassPathTest.class文件的带包绝对路径，不包括自身
        
        System.out.println(Thread.currentThread().getContextClassLoader().getResource(""));
        //file:/D:/Cloud/Projects/Test/build/classes/
        //与ClassPathTest.class.getResource("/")一样
        
        System.out.println(ClassPathTest.class.getClassLoader().getResource(""));
        //与ClassPathTest.class.getResource("/")一样
    }
}
